package com.zipking.cloud.springbootmybatis.service;

import com.google.common.collect.Maps;
import com.zipking.cloud.springbootmybatis.persistance.entity.MsgLog;
import com.zipking.cloud.springbootmybatis.persistance.mapper.MsgLogMapper;
import com.zipking.cloud.springbootmybatis.util.SpringUtils;
import org.checkerframework.checker.nullness.qual.Nullable;

import java.util.List;
import java.util.Map;
import java.util.concurrent.Callable;

public class ThredQueryExt<T>  implements Callable<List<T>> {



    private int start;

    private int end;

    //每个线程查询出来的数据集合
    private List<MsgLog> datas;

    public  ThredQueryExt(int start,int end) {
        this.start=start;
        this.end=end;

    }

    //返回数据给Future
    @Override
    public  List<T>call() throws Exception {
        /******通过service查询得到对应结果******/
        Map<@Nullable String, @Nullable Object> map = Maps.newHashMap();
        map.put("limit",start);
        map.put("num",end);
        MsgLogMapper msgLogMapper = SpringUtils.getBean(MsgLogMapper.class);
        //queryWrapper .last("limit "+offset+", "+num);
        List duyanCallRecordDetailList = msgLogMapper.selectListByWhere(map);
        return duyanCallRecordDetailList;
    }

}
